package com.boonya.rmi.order.entity;

import org.hibernate.annotations.Proxy;
import org.springframework.stereotype.Component;
import javax.persistence.*;
import java.io.Serializable;

/**
 * @ClassName: Order
 * @Description: TODO(订单详情类JPA配置)
 * @author: pengjunlin
 * @motto: 学习需要毅力，那就秀毅力
 * @date 2021/4/21 15:31
 */
@Proxy(lazy = false)// 解决懒加载异常: https://www.gaoyaxuan.net/blog/229.html
@Component
@Entity
@Table(name = "ORDER_TB")
public class Order implements Serializable {

    @Id    //主键id
    @GeneratedValue(strategy = GenerationType.IDENTITY)//主键生成策略
    @Column(name = "ORDER_ID")//数据库字段名
    private Integer id;

    @Column(name = "ORDER_NAME")//数据库字段名
    private String name;

    @Column(name = "ORDER_PRICE")//数据库字段名
    private double price;

    @Column(name = "ORDER_DISCOUNT")//数据库字段名
    private double discount = 1.0;

    @Column(name = "ORDER_NUMBER")//数据库字段名
    private int number;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public double getDiscount() {
        return discount;
    }

    public void setDiscount(double discount) {
        this.discount = discount;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }
}
